//
//  ViewController.swift
//  optionalWidget
//
//  Created by ap0stader on 2023/10/19.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }
    
    @IBOutlet var theSwitch: UISwitch!
    
    @IBOutlet var theSegmented: UISegmentedControl!
    
    @IBOutlet var theSlider: UISlider!
    
    @IBOutlet var switchLabel: UILabel!
    
    @IBOutlet var segmentedLabel: UILabel!
    
    @IBOutlet var sliderLabel: UILabel!
    
    @IBAction func switchValueChanged(_ sender: Any) {
        
        if theSwitch.isOn {
            switchLabel.text = "On"
        } else {
            switchLabel.text = "Off"
        }
    }
    
    @IBAction func segmentedValueChanged(_ sender: Any) {
        let label : [String] = ["First", "Second", "Third"]
        segmentedLabel.text = label[theSegmented.selectedSegmentIndex]
    }
    
    @IBAction func sliderValueChanged(_ sender: Any) {
        sliderLabel.text = String(Int(theSlider.value))
    }
    
}

